package com.heima.kafka.listener;

import com.alibaba.fastjson.JSON;
import com.heima.kafka.pojo.User;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * create 2023/6/23 10:55
 */


@Component
public class HelloListener {


    @KafkaListener(topics = "heima")
    public void listener(String message) {
        User user = JSON.parseObject(message, User.class);
        System.out.println("收到消息："+user);
    }
}
